package com.hgk.wanwan.search.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.common.handmark.pulltorefresh.library.internal.BallBaseAdapter;
import com.common.nostra13.universalimageloader.core.DisplayImageOptions;
import com.common.nostra13.universalimageloader.core.ImageLoader;
import com.hgk.common.common.util.LoadImageDisplayOption;

import width.hgk.wanwan.R;

/**
 * Created by lenovo on 2016/9/29.
 */
public class SearchAdapter extends BallBaseAdapter {
    private Context mContext;
    private ImageLoader mImageLoader;
    private LayoutInflater mLayoutInflater;
    private DisplayImageOptions displayImageOptions;
    private String mType;

    public SearchAdapter(Context context) {
        super(context);
        this.mContext = context;
        mImageLoader = ImageLoader.getInstance();
        mLayoutInflater = LayoutInflater.from(mContext);
        displayImageOptions = LoadImageDisplayOption.getDefaultIcon(R.drawable.icon);
    }

    public void setFrom(String type){
        mType = type;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHoudler vh = null;
        if (convertView==null){
            vh = new ViewHoudler();
            if (mType.equals("1")) {
                convertView = mLayoutInflater.inflate(R.layout.search_item_one, null) ;
                vh.mSearchName = (TextView) convertView.findViewById(R.id.tv_search_item_name);

            }else{

            }
            convertView.setTag(vh);
        }else{
            vh = (ViewHoudler) convertView.getTag();
        }

        return super.getView(position, convertView, parent);
    }
    public class ViewHoudler{
        private TextView mSearchName;
    }
}
